﻿using System;
using System.Web;
using System.Web.Routing;

namespace MikeKappel.Com
{
    public interface IRoutableHttpHandler : IHttpHandler
    {
        RequestContext RequestContext { 
            get;
            set; 
        }
    }

    public class RequestRouter<T> : IRouteHandler
        where T : IRoutableHttpHandler, new()
    {
        public IHttpHandler GetHttpHandler(RequestContext requestContext)
        {
            T handler = new T();
            handler.RequestContext = requestContext;
            return handler;
        }
    }
    public class UrlRewriter : IRoutableHttpHandler
    {
        public void ProcessRequest(HttpContext context)
        {
                context.Response.ContentType = "text/plain";
                context.Response.Write("TEST");
        }
        public bool IsReusable
        {
            get { return false; }
        }
        public RequestContext RequestContext { 
            get; 
            set;
        }
    }
}